/* FILE : imm.c */

#include <unistd.h>
#include <standard_im.h>

#include "imm.h"

typedef struct _IMBuffer {
	union {
		IMMCommand immCommand;
		IMECommand imeCommand;
	} command;

	void *buffer;
	size_t bufSize;
} IMBuffer;

static int imm_open_connection(void);
static void imm_close_connection(void);
static int imm_get_connection_number(void);
static IME_Bool imm_has_pending_event(void);
static void imm_filter_event(void);
static void imm_register_properties(const IME_PropertiesList *);
static void imm_update_property(const IME_Property *);
static void imm_send_ime_event(int, const char *, const void *, size_t);
static void imm_send_key_event(int, const char *, const IME_KeyEvent *);
static void imm_commit_string(int, const char *, const char *);
static void imm_forward_key_event(int, const char *, const IME_KeyEvent *);
static void imm_read_config(const char *, void *, size_t);
static void imm_write_config(const char *, void *, size_t);
static void imm_load_user_data(const char *, void **, size_t*);
static void imm_free_user_data(void *);
static void imm_save_user_data(const char *, const void *, size_t);

IMM_Helper_Functions imm_helper_functions;
static const char *version = "1.0";


int
imm_init(void)
{
	imm_helper_functions.version = version;
	imm_helper_functions.open_connection = imm_open_connection;
	imm_helper_functions.close_connection = imm_close_connection;
	imm_helper_functions.get_connection_number = imm_get_connection_number;
	imm_helper_functions.has_pending_event = imm_has_pending_event;
	imm_helper_functions.filter_event = imm_filter_event;
	imm_helper_functions.register_properties = imm_register_properties;
	imm_helper_functions.update_property = imm_update_property;
	imm_helper_functions.send_ime_event = imm_send_ime_event;
	imm_helper_functions.send_key_event = imm_send_key_event;
	imm_helper_functions.commit_string = imm_commit_string;
	imm_helper_functions.forward_key_event = imm_forward_key_event;
	imm_helper_functions.read_config = imm_read_config;
	imm_helper_functions.write_config = imm_write_config;
	imm_helper_functions.load_user_data = imm_load_user_data;
	imm_helper_functions.free_user_data = imm_free_user_data;
	imm_helper_functions.save_user_data = imm_save_user_data;
	return 1;
}

static int
imm_open_connection()
{
	return 1;
}

static void
imm_close_connection()
{
	return;
}

static int
imm_get_connection_number()
{
	return 1;
}

static IME_Bool
imm_has_pending_event()
{
	return IME_TRUE;
}

static void
imm_filter_event()
{
	return;
}

static void
imm_register_properties(const IME_PropertiesList *properties)
{
	return;
}

static void
imm_update_property(const IME_Property *property)
{
	return;
}

static void
imm_send_ime_event(int ic, const char *ic_uuid, const void *buf, size_t buf_size)
{
	return;
}

static void
imm_send_key_event(int ic, const char *ic_uuid, const IME_KeyEvent *key)
{
	return;
}

static void
imm_commit_string(int ic, const char *ic_uuid, const char *string)
{
	return;
}

static void
imm_forward_key_event(int ic, const char *ic_uuid, const IME_KeyEvent *key)
{
	return;
}

static void
imm_read_config(const char *key, void *buf, size_t buf_size)
{
	return;
}

static void
imm_write_config(const char *key, void *buf, size_t buf_size)
{
	return;
}

static void
imm_load_user_data(const char *key, void **buf, size_t *buf_size)
{
	return;
}

static void
imm_free_user_data(void *buf)
{
	return;
}

static void
imm_save_user_data(const char *key, const void *buf, size_t buf_size)
{
	return;
}
